import {buildUrl, postApi, postJsonApi, getApi} from "./config"

let APP_CRAWL = "/factoring-crawler";
let APP_VOICE = "/factoring-voice";
let APP_API = "/factoring-api";
let APP_verify = "/verify-miniprog-api";
let maintain_api = "/maintain-miniprog-api"

export default {
    appPath: {
        defaultApp: "",
        crawler: APP_CRAWL,
    },
    buildUrl: buildUrl,
    // 获取基础url
    baseUrl: (appPath) => buildUrl("", appPath),
    captchaUrl: (appPath) => buildUrl("/captcha", appPath),
    // 生成文件加载路径
    fileUrl: (fileId, appPath) => buildUrl(`/file/${fileId}`, appPath),
    contractPdfUrl: (fileId,appPath) => buildUrl(`/newC/preview/${fileId}`, appPath),
    // 生成文件上传路径
    uploadUrl: (dirName, appPath) => buildUrl(`/file/upload/${dirName}`, appPath),
    excelImportUploadUrl: () =>buildUrl("ent/excelImport", APP_verify),
    orderdownload:(fileId)=>buildUrl(`file/${fileId}`),

    /** 登录 */
    login: postApi("/login"),
    getLogined: getApi("/getLogined"),
    checkLogined: getApi("/checkLogined"),
    changeAvatar: postApi("/changeAvatar"),
    changePwd: postApi("/changePwd"),
    logout: getApi("/logout"),

    /** 字典管理 */
    dic: {
        valueLabel: getApi("/dic/valueLabel"),
        createDicKey: postJsonApi("/dic/createDicKey"),
        updateDicKey: postJsonApi("/dic/updateDicKey"),
        getDicKey: getApi("/dic/getDicKey"),
        deleteDicKey: postApi("/dic/deleteDicKey"),
        pageDicKey: getApi("/dic/pageDicKey"),
        createDicValue: postJsonApi("/dic/createDicValue"),
        updateDicValue: postJsonApi("/dic/updateDicValue"),
        getDicValue: getApi("/dic/getDicValue"),
        deleteDicValue: postApi("/dic/deleteDicValue"),
        listDicValue: getApi("/dic/listDicValue"),
    },

    /** 文件管理 */
    goods: {
        addGoods: postJsonApi("goods/addGoods"),
        getGoods: getApi("goods/getGoods"),
    },
    income: {
        addIncome: postJsonApi("income/addIncome"),
        getIncome: getApi("income/getIncome"),
    },
    investment:{
        addInvestment: postJsonApi("investment/addInvestment"),
        getInvestment: getApi("investment/getInvestment"),
    },
    member:{
        addMember: postJsonApi("member/addMember"),
        getMemberList: getApi("member/getMemberList"),
    },
    
};
